<?php
/**
 * RedCross Application
 *
 * @copyright Copyright (c) 2010, Kristian Stokke Tryggestad, Rune Vikestad, Andreas Flaten Wist, Simen Nicolai Echholt, Ole Henrik Jahren
 */


class Admin_Form_Member_PermanentPassive extends RedCross_Form 
{
	public function init() 
	{

		$this->addElement('text', 'comment', array(
			'filters'		=> array('StringTrim'),
			'validators'	=> array(
				array('StringLength', true, array(0,255))
            ),
            'label' 	=> 'Kommentar'
		));

		$this->addElement('submit',  Admin_MemberController::SUBMIT_PERMANENTPASSIVE, array(
            'required' => true,
            'ignore'   => true,
        ));

        $this->getElement(Admin_MemberController::SUBMIT_PERMANENTPASSIVE)->setDecorators($this->_buttonElementDecorators);
	}
	
	public function fillForm($isPassive)
	{
        $submit = $this->getElement(Admin_MemberController::SUBMIT_PERMANENTPASSIVE);
        if ($isPassive) {
            $submit->setLabel('Fjern permanent passivmelding');
            $this->removeElement('comment');
        } else {
            $submit->setLabel('Sett som permanent passiv');
        }
	}
}		